<ol id="sections">
    <li class="section">
        <div class="dp-content">
            <div id="doctor">
                <div id="doctor-left-info">
                    <div id="doctor-main-details">
                        <div id="doctor-main-photo" class="inline-block"> 
                            <?php $user = $doctor->getUser() ?>
                            <?php include_partial("doctor_show/potrait", array("doctor" => $doctor, "height" => 128)) ?>
                        </div>
                        <div id="main-info" class="inline-block">
                            <h1><?php echo $doctor->getUser() ?></h1>
                            <div class="doctor-rating rating" id="doctor-rating-<?php echo $doctor->getId() ?>">
                                <?php include_partial("rating", array("doctor" => $doctor, "doctorAverageRating" => $doctorAverageRating)) ?>
                            </div>
                            <div class="doctor-level">Level <?php echo floor($doctor->getLevel()->getPoints() / 10) ?></div>
                            <div class="doctor-actions">  
                                <?php $connection = $user->getConnection($sf_user->getUserId()) ?>
                                <div class="connet doctor-<?php echo $connection['relationship'] ?>" userid="<?php echo $user->getId() ?>" status="<?php echo $connection['status'] ?>"><?php echo ucfirst($connection['relationship']) ?></div>
<!--                                <div class="connet doctor-recommend" userid="31" status="accepted">Recommend</div>                            -->
                            </div>                            
                        </div>
                    </div>
                    <div id="doctor-specialities">
                        <h3  class="grey-bg-title">Specialities</h3>
                        <?php include_partial("speciality/list", array("doctorSpecialities" => $doctor->getSpecialities())) ?>
                    </div>
                    <div id="doctor-show">
                        <h3  class="grey-bg-title">Doctor's show</h3>
                        <?php include_partial("doctor_show/mini_potraits", array("doctor" => $doctor, "height" => 32)) ?>
                    </div>
                    <div id="doctor-recent-top-answers">
                        <h3 id="recent-top-answers" class="grey-bg-title">Recent top answers</h3>      
                        <?php include_partial("answer/recent", array("answers" => $doctor->getRecentAnswers())) ?>
                    </div>
                </div>
                <div id="doctor-right-info">
                    <div id="doctor-header" class="account-header">
                        <ul role="navigation" class="tabs clearfix" id="settings_nav">
                            <li class="active">
                                <a href="javascript:;" tab="doctor-info">Info</a>				
                            </li>      
                            <li>
                                <a href="javascript:;" tab="doctor-questions-answers">Questions & Answers</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-activity-feed">Activity Feed</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-member-reviews">Member Reviews</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-network">Network</a>				
                            </li>
                            <li>
                                <a href="javascript:;" tab="doctor-health-advice">Health Advice</a>				
                            </li>
                        </ul>			
                    </div>                    
                    <div id="doctor-info" class="doctor-body">
                        <div class="doctor-row">
                            <div class="doctor-info-row" id="locations">
                                <h2>For appointments:</h2>
                                <ul>
                                    <?php foreach ($doctor->getLocations() as $doctorLocation): ?>
                                        <li>
                                            <div class="inline-block">
                                                <?php echo $doctorLocation->getStreetAddress() ?>,
                                                <?php echo $doctorLocation->getArea() ?><br/>
                                                <?php echo $doctorLocation->getCity() ?>,
                                                <?php echo $doctorLocation->getPostCode() ?><br/>
                                                <strong>t:</strong> <?php echo $doctorLocation->getPhone() ?>
                                                <strong>f:</strong> <?php echo $doctorLocation->getFax() ?>
                                            </div>
                                            <div class="inline-block location-map">                                                
                                            </div>
                                        </li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                            <div class="doctor-info-row" id="professional-statement">
                                <h2>Professional Statement:</h2>
                                <span><?php echo $doctor->getProfessionalStatement() ?></span>
                            </div>
                            <div class="doctor-info-row" id="education">
                                <h2>Education:</h2>
                                <ul>
                                    <?php foreach ($doctor->getAchievements() as $doctorAchievement): ?>
                                        <li><?php echo $doctorAchievement->getInstitution() ?> - <?php echo $doctorAchievement->getStudy() ?></li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                            <div class="doctor-info-row" id="languages">
                                <h2>Languages:</h2>
                                <ul>
                                    <?php foreach ($doctor->getLanguages() as $doctorLanguage): ?>
                                        <li><?php echo $doctorLanguage->getLanguage()->getName() ?></li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                            <div class="doctor-info-row" id="hospital-affiliations">
                                <h2>Hospital Affiliations:</h2>
                                <ul>
                                    <?php foreach ($doctor->getHospitals() as $doctorHospital): ?>
                                        <li><?php echo $doctorHospital->getName() ?></li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>                          
                            <div class="doctor-info-row" id="professional-Memberships">
                                <h2>Professional Memberships:</h2>
                                <ul>
                                    <li>South African Doctors Association</li>
                                    <li>Cape Town Medical Society</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div id="doctor-questions-answers" class="doctor-body hide">
                        <div class="doctor-row">
                            <?php include_partial("answer/list", array("form" => $answerCommentForm, "howMany" => "single", "answers" => $doctor->getAnswers())) ?>          
                        </div>
                    </div>
                    <div id="doctor-activity-feed" class="doctor-body hide">
                        <div class="doctor-row">
                            <?php include_partial("profile/activity_logs", array("activityLogs" => $user->getActivityLogs())) ?>
                        </div>
                    </div>
                    <div id="doctor-member-reviews" class="doctor-body hide"> 
                        <div class="doctor-row">
                            <div class="inline-block">
                                <button class="blue-button-25" type="submit" id="invoke-review-form">Review</button>
                            </div>
                        </div>      
                        <div class="doctor-row">
                            <?php include_partial("doctor_review/list", array("doctorReviews" => $doctor->getReviews())) ?>
                        </div>
                    </div>
                    <div id="doctor-network" class="doctor-body hide">
                        <div class="doctor-row network-tabs">
                            <div tab="connection-followers" class="inline-block active">Followers (<?php echo $user->getFollowers()->count() ?>)</div>
                            <div tab="connection-following" class="inline-block">Following (<?php echo $user->getFollowing()->count() ?>)</div>
                        </div>
                        <div class="doctor-row connections" id="connection-followers">
                            <?php include_partial("connection/followers", array("connections" => $user->getFollowers())) ?>
                        </div>
                        <div class="doctor-row connections" style="display: none;" id="connection-following">
                            <?php include_partial("connection/following", array("connections" => $user->getFollowing())) ?>
                        </div>
                    </div>
                    <div id="doctor-health-advice" class="doctor-body hide">
                        <div class="doctor-row">
                            <div class="inline-block">
                                <button id="invoke-health-advice-form" class="blue-button-25" type="submit">Advice</button>
                            </div>
                        </div>  
                        <div class="doctor-row">
                            <div id="doctor-health-advices">
                                <?php include_partial("doctor_health_advice/list", array("doctorHealthAdvices" => $doctor->getHealthAdvices())) ?>
                            </div>                            
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </li>
</ol>
<div style="display: none;">
    <div id="book-now-form-holder"></div>
</div>
<div style="display: none;">
    <div id="review-form-holder"></div>    
    <input type="hidden" name="my_doctor_review_id" id="my_doctor_review_id"/>
</div>
<div style="display: none;">
    <div id="refer-friend-form-holder"></div>
</div>
<div style="display: none;">
    <div id="question-form-holder"></div>
</div>
<div style="display: none;">
    <div id="answer-form-holder"></div>
</div>
<script type="text/javascript">
    $(document).ready(function(){    
        // initialise our doctor's slideshow
        $(".slideshow").colorbox({rel:'slideshow', slideshow:true,  "close":closeHtml});        
        
        // automatically load the doctor review form
        $("#review-form-holder").load('/doctor-review-new/<?php echo $doctor->getId() ?>');
        
        // automatically load the doctor advice form
        $("#question-form-holder").load('/doctor-ask/<?php echo $doctor->getId() ?>');

        $("#invoke-health-advice-form").live("click", function(){
            var url = '<?php echo url_for('@doctor_health_advice_new') ?>';
            $.get(url, {}, function(data){
                if(data == 'signin'){
                    requestLogin();
                }
                else{
                    openPopup(url, '700px', '480px');
                }
            }, 'html');
        });
        
        $("#invoke-refer-friend-form").live("click", function(){
            // load the refer friend form
            $.get('/refer-friend', {}, function (data){
                $("#refer-friend-form-holder").html(data);
                $.colorbox({inline:true, width:"700px", height:"660px", href:"#refer-friend-form-holder", "close":closeHtml});
            }, 'html');
        });
        
        // automatically load the book now time slots
        $("#book-now-box").load('/appointment-book-now/<?php echo $doctor->getId() ?>');    
        
        $(".rate-health-advice").live("click", function(){
            $("#health-advice-rating-" + $(this).attr("adviceid")).load("/doctor-health-advice/rate/" + $(this).attr("adviceid") + "/" + $(this).attr("rating"));
        });
        
        // invoke the color boxes
        $("#invoke-book-now-form").colorbox({inline:true, width:"688px", height:"540px", href:"#book-now-form-holder", "close":closeHtml});
        $("#invoke-review-form").colorbox({inline:true, width:"700px", height:"350px", href:"#review-form-holder", "close":closeHtml});
    });
</script>
